/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kungkhies.persistence.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author clayton
 */
@Entity 
@Table(name = "activity_url")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "ActivityUrl.findAll", query = "SELECT a FROM ActivityUrl a"),
    @NamedQuery(name = "ActivityUrl.findByActivityUrlId", query = "SELECT a FROM ActivityUrl a WHERE a.activityUrlId = :activityUrlId"),
    @NamedQuery(name = "ActivityUrl.findByUrl", query = "SELECT a FROM ActivityUrl a WHERE a.url = :url")
})
public class ActivityUrl implements Serializable 
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "activity_url_id")
    private Long activityUrlId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2083)
    @Column(name = "url")
    private String url;
    @JoinColumn(name = "activity_id", referencedColumnName = "activity_id")
    @ManyToOne(optional = false)
    private Activity activityId;

    public ActivityUrl()
    {
    }

    public ActivityUrl(Long activityUrlId)
    {
        this.activityUrlId = activityUrlId;
    }

    public ActivityUrl(Long activityUrlId, String url)
    {
        this.activityUrlId = activityUrlId;
        this.url = url;
    }

    public Long getActivityUrlId()
    {
        return activityUrlId;
    }

    public void setActivityUrlId(Long activityUrlId)
    {
        this.activityUrlId = activityUrlId;
    }

    public String getUrl()
    {
        return url;
    }

    public void setUrl(String url)
    {
        this.url = url;
    }

    public Activity getActivityId()
    {
        return activityId;
    }

    public void setActivityId(Activity activityId)
    {
        this.activityId = activityId;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (activityUrlId != null ? activityUrlId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ActivityUrl))
        {
            return false;
        }
        ActivityUrl other = (ActivityUrl) object;
        if ((this.activityUrlId == null && other.activityUrlId != null) || (this.activityUrlId != null && !this.activityUrlId.equals(other.activityUrlId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.kungkhies.persistence.entities.ActivityUrl[ activityUrlId=" + activityUrlId + " ]";
    }

}
